
package conexion;

import java.sql.*;

public class conexionBD {

    //Atributos
    private Connection conn = null;
    private String driver = "com.mysql.jdbc.Driver";
    private String url = "jdbc:mysql://";
    private String bd = "aconcagua";
    private String host = "localhost";
    private String user = "root";
    private String pass = "";
    private String puerto = "3306";

    //Constructores
    public conexionBD() {
    }

    //Getters && Setters
    public Connection getConn() {
        return conn;
    }
    public void setConn(Connection conn) {
        this.conn = conn;
    }

    //Métodos específicos
    public void connect() throws Exception {
        try{
            Class.forName(driver).newInstance();
            conn = DriverManager.getConnection(url+host+":"+puerto+"/"+bd,user,pass);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

}
